From: Bene Date: Mon, 3 Feb 2014 20:58:53 +0000 (+0100) Subject: Add SkinTemplateGetLanguageLink hook X-Git-Tag: 1.31.0-rc.0~16991^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=f597dd7ff3a94bfd9b332e5cc1391910ac14b995;p=lhc%2Fweb%2Fwiklou.git Add SkinTemplateGetLanguageLink hook Added SkinTemplateGetLanguageLink hook to allow changing the html of language links. This is needed by the Wikibase extension to display badges of sitelinks. Bug: 60717 Change-Id: I223bf7a7bb0d13942a81b1766acbee62e080348d --- diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index cd602a1d58..fe0eabf7d0 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -84,6 +84,8 @@ production. revision comparison pages using syntax such as [[Special:Diff/12345]], [[Special:Diff/12345/prev]] or [[Special:Diff/12345/98765]]. * New user accounts' personal and talk pages are now watched by them by default. +* Added SkinTemplateGetLanguageLink hook to allow changing the html of language + links. === Bug fixes in 1.23 === * (bug 41759) The "updated since last visit" markers (on history pages, recent diff --git a/docs/hooks.txt b/docs/hooks.txt index a638703aca..37ac2bea06 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2193,6 +2193,13 @@ link" tab. $sktemplate: SkinTemplate object $nav_urls: array of tabs +'SkinTemplateGetLanguageLink': After building the data for a language link from +which the actual html is constructed. +&$languageLink: array containing data about the link. The following keys can be + modified: href, text, title, class, lang, hreflang. Each of them is a string. +$languageLinkTitle: Title object belonging to the external language link +$title: Title object of the page the link belongs to + To alter the structured navigation links in SkinTemplates, there are three hooks called in different spots: diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 35183ce252..7e229ee285 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -175,7 +175,7 @@ class SkinTemplate extends Skin { } $ilInterwikiCodeBCP47 = wfBCP47( $ilInterwikiCode ); - $languageLinks[] = array( + $languageLink = array( 'href' => $languageLinkTitle->getFullURL(), 'text' => $ilLangName, 'title' => $ilTitle, @@ -183,6 +183,8 @@ class SkinTemplate extends Skin { 'lang' => $ilInterwikiCodeBCP47, 'hreflang' => $ilInterwikiCodeBCP47, ); + wfRunHooks( 'SkinTemplateGetLanguageLink', array( &$languageLink, $languageLinkTitle, $this->getTitle() ) ); + $languageLinks[] = $languageLink; } }